<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:oc="http://java.sun.com/jsf/composite/owncomponents"
	xmlns:p="http://primefaces.org/ui">
<h:body>
	<ui:composition template="template/template.xhtml">
		<ui:define name="content">
			<h:form id="form" styleClass="horizontal_full">
				<p:panel>
						<h1>Agent Update</h1>
						<p>
							Each of the three preferences describes how important this preference is for the Agenttype. For the utility calculation each of the concrete preferences will be weighted in relation to the other concrete preference values.
							If you choose the mean preference value 100 for each of the preferences the mean weight will be 1/3 for each. The same results if you choose the mean preference value 50 for each mean preferences.
						</p>	
					    <h:panelGrid id="agentTypeConfig" columns="4" rowClasses="height50">
					    	
					    	<h:outputText value="Name"></h:outputText>
					        <p:inputText id="name" value="#{adminMBean.agentName}" required="true"/>
					        <p></p>
					        <oc:fieldhelp helptext="Setting the name for the AgentType." show="true"/>
   								    	
					    	<h:outputText value="Mean Price Preference"></h:outputText>
					        <p:inputText id="priceMean" value="#{adminMBean.agentMeanPricePreference}" required="true"
					        converterMessage="Mean price preference has to be between 0 and 100."
							validatorMessage="Mean price preference has to be between 0 and 100.">
					        	<f:validateLongRange minimum="0" maximum="100" />
					        </p:inputText>
					        <p:slider for="priceMean" step="10" style="min-width: 100px" update="weightingText"/>
					        <oc:fieldhelp helptext="Setting the mean price for the normally distributed weighted preference of the price for all agents. High preference for price means that you prefer cheaper products to more expensive ones." show="true"/>

					    	<h:outputText value="Mean Quality Preference"></h:outputText>
					        <p:inputText id="qualityMean" value="#{adminMBean.agentMeanQualityPreference}" required="true"
					        converterMessage="Mean quality preference has to be between 0 and 100."
							validatorMessage="Mean quality preference has to be between 0 and 100.">
					        	<f:validateLongRange minimum="0" maximum="100" />
					        </p:inputText>
					        <p:slider for="qualityMean" step="10" style="min-width: 100px"/>
					        <oc:fieldhelp helptext="Setting the mean quality for the normally distributed weighted preference of the price for all agents. High preference means that you prefer products with a higher quality." show="true"/>
   
					    	<h:outputText value="Mean Image Preference"></h:outputText>
					        <p:inputText id="imageMean" value="#{adminMBean.agentMeanImagePreference}" required="true"
					        converterMessage="Mean image preference has to be between 0 and 100."
							validatorMessage="Mean image preference has to be between 0 and 100.">
					        	<f:validateLongRange minimum="0" maximum="100" />
					        </p:inputText>
					        <p:slider for="imageMean" step="10" style="min-width: 100px"/>
					        <oc:fieldhelp helptext="Setting the image price for the normally distributed weighted preference of the price for all agents. High preference means that you prefer companies with a better image than the ones with a lower image." show="true"/>
					    
					    <!-- nach Besprechung am 27.03 nicht notwendig
					    	<h:outputText value="Budget for Agent"></h:outputText>
					    	<p:inputText id="budgetAgent" value="#{adminMBean.agentBudgetPerPeriod}" required="true">
					    		<f:validateLongRange minimum="1" maximum="10000" />
					    	</p:inputText>
					    	<p></p>
					    	<oc:fieldhelp helptext="Setting the available budget for the AgentType." show="true"/>
					     -->
					    
					    	<h:outputText value="Number of Agents"></h:outputText>
					    	<p:inputText id="numberAgents" value="#{adminMBean.agentNumberGeneration}" required="true" title="number agents"
					    	converterMessage="Number of Agents has to be a number between 1 and 1000."
							validatorMessage="Number of Agents has to be a number between 1 and 1000.">
					    		<f:validateLongRange minimum="1" maximum="10000" />
					    	</p:inputText>
					    	<p></p>
					    	<oc:fieldhelp helptext="Setting the number of Agents that will be generated in this round for the simulation." show="true"/>
					    	
					    	<p></p>
					    	<h:outputText/>
					    	<h:outputText/>
					    	<h:outputText/>
					 
					    	<p:commandButton value="Calculate Weightings" update="weightingText" ajax="true"/>
					    </h:panelGrid>
					    
					    <p></p>
					    <h:outputText id="weightingText" value="#{adminMBean.getMeanWeightingText()}"></h:outputText>
					    
					    <p></p>
					    <p></p>
					    
					    <p:commandButton action="#{adminMBean.actionUpdateAgentType()}" id="saveButton" value="Save" update=":messages" icon="ui-icon-disk" title="Icon Only" />
						
						<p:blockUI block=":form" trigger="saveButton">
									Creating Agents<br></br>
									<p:graphicImage library="img" name="ajaxloadingbar.png"/>
								</p:blockUI>
						
						<p:commandButton action="#{adminMBean.actionAbortAgentType()}" id="abortButton" value="Abort" update=":messages" icon="ui-icon-circle-close" title="Icon Only" immediate="true"/>
						
					</p:panel>
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>